Skip to content

[MAIN] [STRATCONN-6317] Replaced tags into properties#835

Open
AnkitSegment wants to merge 3 commits intomasterfrom
STRATCONN-6317-optimizely
Open

[MAIN] [STRATCONN-6317] Replaced tags into properties#835
AnkitSegment wants to merge 3 commits intomasterfrom
STRATCONN-6317-optimizely

Conversation

@AnkitSegment
Copy link
Copy Markdown
Contributor

What does this PR do?

Replaced the tags key with properties in alignment with Optimizely’s Web API updates.

JIRA ticket: https://twilio-engineering.atlassian.net/browse/STRATCONN-6317

Testing

Any background context you want to provide?

Is there parity with the server-side/android/iOS integration components (if applicable)?

Does this require a new integration setting? If so, please explain how the new setting works

Links to helpful docs and other external resources

var payload = {
type: 'event',
eventName: eventName,
tags: eventProperties
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add testing details

Copilot AI review requested due to automatic review settings April 16, 2026 12:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Optimizely Analytics.js integration to use properties instead of tags in the Web event payload, aligning with Optimizely Web API changes.

Changes:

  • Switched Optimizely Web track payload key from tags to properties.
  • Updated Optimizely integration tests to assert properties instead of tags.
  • Bumped the integration package version from 3.5.1 to 3.5.2.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
integrations/optimizely/lib/index.js Changes the outgoing Optimizely event payload key to properties and passes it through to the Fullstack client track call.
integrations/optimizely/test/index.test.js Updates expected pushed payloads and test descriptions to use properties.
integrations/optimizely/package.json Increments the package version for the integration release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 825 to +833
it('should not include revenue on a non Order Completed event if `onlySendRevenueOnOrderCompleted` is enabled', function() {
analytics.initialize();
analytics.track('Order Updated', {
revenue: 25
});
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Updated',
tags: {}
properties: {}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These test descriptions refer to the option name onlySendRevenueOnOrderCompleted, but the integration option is sendRevenueOnlyForOrderCompleted. Updating the wording here would keep the tests aligned with the implementation and reduce confusion.

Copilot uses AI. Check for mistakes.
Comment on lines 1082 to +1087
it('should repace colons with underscore in eventName', function() {
analytics.track('event:foo:bar');
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'event_foo_bar',
tags: {}
properties: {}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in test name: repacereplace. This makes the test output/readability clearer.

Copilot uses AI. Check for mistakes.
Comment on lines 113 to +116
var payload = {
type: 'event',
eventName: eventName,
tags: eventProperties
properties: eventProperties
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change switches the Optimizely Web track payload from tags to properties. The in-file docs indicate Classic consumes tags for revenue; if Classic support is still a requirement, consider sending both keys (or gating by snippet/API version) so existing Classic implementations don’t silently drop event metadata.

Copilot uses AI. Check for mistakes.
Comment on lines 112 to +116
var eventName = track.event().replace(/:/g, '_'); // can't have colons so replacing with underscores
var payload = {
type: 'event',
eventName: eventName,
tags: eventProperties
properties: eventProperties
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docblock for track still refers to sending event data as tags (and mentions Classic consuming a tags object), but the payload now uses properties. Please update the comment (and any in-file references) to match the new payload key to avoid misleading future maintenance.

Copilot uses AI. Check for mistakes.
Comment on lines 541 to +549
it('should not include revenue on a non Order Completed event if `onlySendRevenueOnOrderCompleted` is enabled', function() {
analytics.initialize();
analytics.track('Order Updated', {
revenue: 25
});
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Updated',
tags: {}
properties: {}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These test descriptions refer to the option name onlySendRevenueOnOrderCompleted, but the integration option is sendRevenueOnlyForOrderCompleted (as used throughout the file). Consider updating the wording here to the actual option name to prevent confusion when debugging test failures.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants